package com.example.personal.mvvm.adapter

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.example.personal.R
import com.example.personal.mvvm.bean.LegendTextInfo
import com.gsafety.libraryktx.widget.LegendText

/**legendText适配器
 * @author : lj
 * @date : 2021/1/4 11:01
 */
class LegendAdapter(data: List<LegendTextInfo>) : BaseQuickAdapter<LegendTextInfo, BaseViewHolder>(R.layout.personal_item_legend, data) {
    override fun convert(helper: BaseViewHolder?, item: LegendTextInfo) {
      var legendText= helper?.getView<LegendText>(R.id.lt_legend)
      legendText?.also {
          it.setTitle(item.name)
          it.setValue("${item.value}")
          it.setbg(mContext.resources.getColor(item.color))
      }
    }
}